/**
 * Copyright 2011 Joe Choi, All rights reserved.
 */
package tec.fs.syn;

import java.io.File;

import tao.data.structure.tree.PreOrderBuildHandler;
import tao.data.structure.tree.Tree;
import tec.fs.GrowableFileTree;

/**
 * @author Joe Choi
 */
public class TargetCreation implements PreOrderBuildHandler.Creation<File, File, GrowableFileTree> {
	public TargetCreation(File repo) {
		this.repository = repo;
	}
	
	@Override
	public GrowableFileTree create(GrowableFileTree parent, Tree<File> node) {
		File f = (parent != null) ? 
					new File(parent.getValue(), node.getValue().getName()) : 
					new File(repository, node.getValue().getName());
		return(new GrowableFileTree(f));
	}
	
	private File repository;
}
